//
// Created by liushuai on 2021/1/24.
//

#include "deleteDuplicates.h"
ListNode* deleteDuplicates(ListNode* head) {
    if(!head)
        return head;
    else{
        ListNode* current = head;
        ListNode* preNode = head;
        while (current){
            current=current->next;
            while (current&&current->val == preNode->val){
                current=current->next;
            }
            preNode->next = current;
            preNode = current;

        }
        return head;
    }
}